// Access to DSymLoad.ini

#pragma once

// ----------------------------------------------------------------------------

#include "DSymLoadSettingsEntry.h"

// ----------------------------------------------------------------------------

namespace DSymLoad
{

// ----------------------------------------------------------------------------

class CSettings
{
public:
    CSettings(__in HMODULE hModule);

    void Reset();   // called from c-tor

    void Load();
    void Save() const;

    bool IsOverrideIfExist() const;
    void SetOverrideIfExist(bool bOverrideIfExist);

    bool IsProcessNameCollision() const;
    void SetProcessNameCollision(bool bProcessNameCollision);

    bool IsNoCpp() const;
    void SetNoCpp(bool bNoCpp);

    bool IsUndName() const;
    void SetUndName(bool bUndName);

    const CStringA &GetSymPath() const;
    void SetSymPath(const CStringA &csSymPath);

    const CStringA &GetLibPath() const;
    void SetLibPath(const CStringA &csLibPath);

    static CStringA FormatBool(bool bValue);

protected:
    void Read(
        __in const CSettingsIniEntry &IniEntry,
        __out bool &bValue
    );
    void Read(
        __in const CSettingsIniEntry &IniEntry,
        __out CStringA &csValue
    );

    void Write(
        __in const CSettingsIniEntry &IniEntry,
        __in bool bValue
    ) const;
    void Write(
        __in const CSettingsIniEntry &IniEntry,
        __in const CStringA &csValue
    ) const;

private:
    CStringA m_csFileName;

    const static std::array<CSettingsIniEntry, SettingsEntryBool::CountOf> g_IniEntryBools;
    std::array<bool, SettingsEntryBool::CountOf> m_Bools;

    const static std::array<CSettingsIniEntry, SettingsEntryString::CountOf> g_IniEntryStrings;
    std::array<CStringA, SettingsEntryString::CountOf> m_Strings;
};

// ----------------------------------------------------------------------------

}   // namespace DSymLoad

// ----------------------------------------------------------------------------

